package com.liangdemo.web.tree;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 递归生成一个树
 * @Name LiangErLe
 * @date 2022/6/21 13:27
 */
@ResponseBody
@RestController
@RequestMapping(value = "/tree")
public class MenuController {
    @Autowired
    private MenuServerImpl menuServer;

    @GetMapping()
    public List<Menu> test() {
        List<Menu> menuList = menuServer.selectByAll();
        List<Menu> menuListTree = TreeParser.getTreeList(0, menuList);
        return menuListTree;
    }
}